#include "TcpServer.hpp"
#include "Command.hpp"
#include <memory>

// ./tcpserver server_port
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " server_port" << std::endl;
        exit(USAGE_ERROR);
    }

    Enable_Console_Log_Strategy();

    uint16_t server_port = std::stoi(argv[1]);

    Command cmd;

    std::unique_ptr<TcpServer> tcp_server = std::make_unique<TcpServer>(server_port,bind(&Command::Execute,&cmd,
        std::placeholders::_1,std::placeholders::_2));

    tcp_server->Init();
    tcp_server->Start();

    return 0;
}